import { useRef, useState } from "react"

const DomDemo=()=>{
    const [value,setValue]=useState('')
    const inputRef=useRef(null)
    const getDom=()=>{
        console.log(inputRef);
    }
    return (
      <>
        <input
          type="text"
          ref={inputRef}
          onChange={(e) => setValue(e.target.value)}
          value={value}
        />
        <button onClick={getDom}>获取DOM</button>
      </>
    );
}

export default DomDemo